package com.biwin.module.jwt.starter.config;

import com.biwin.module.jwt.api.properties.BiWinJwtProperties;
import com.biwin.module.jwt.starter.session.BwRedisSessionManager;
import com.biwin.module.jwt.starter.strategy.BwJwtTokenAuthenticationStrategy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

/**
 * BiWin Framework Jwt Token Authentication
 *
 * @author biwin
 * @since 0.0.1
 */
@Configuration
@EnableConfigurationProperties({BiWinJwtProperties.class})
@ComponentScan("com.biwin.module.jwt.starter")
public class JwtAutoConfiguration {

    @Autowired
    private BwRedisSessionManager bwRedisSessionManager;

    @Bean
    public BwJwtTokenAuthenticationStrategy bwJwtTokenAuthenticationStrategy(){
        return new BwJwtTokenAuthenticationStrategy(bwRedisSessionManager);
    }

}
